import 'package:flutter/cupertino.dart';



class SearchModule{

 static void closeKeyboard(BuildContext context) {
    FocusScopeNode currentFocus = FocusScope.of(context);
    /// 键盘是否是弹起状态
    if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) {
      FocusManager.instance.primaryFocus!.unfocus();
    }
  }

 /// 计算时间间隔(天)
 static timeInterval(var startDate,var endDate){
   // var startDate = new DateTime(2020, 12, 20);
   // var endDate = new DateTime.now();
   var days = endDate.difference(startDate).inDays;
   return days;
 }

 /// 计算时间间隔(小时)
 static timeIntervalHour(var startDate,var endDate){
   // var startDate = new DateTime(2020, 12, 20);
   // var endDate = new DateTime.now();
   var hour = endDate.difference(startDate).inMinutes;
   print(hour);
   return hour;
 }

}
